//
//  GKDPageView.h
//  sojex
//
//  Created by longxdragon on 2017/7/4.
//  Copyright © 2017年 finance. All rights reserved.
//

#import <UIKit/UIKit.h>

@class GKDPageView;

@protocol GKDPageViewDelegate <NSObject>

@optional
- (void)pageView:(GKDPageView *)pageView didSelectedAtIndex:(NSInteger)index;

- (void)pageViewDidScrollFormIndex:(NSInteger)fromIndex toIndex:(NSInteger)toIndex progress:(CGFloat)progress;

@end


@protocol GKDPageViewDataSource <NSObject>

@required
- (NSInteger)numberOfViewControllersInPageView;

- (UIViewController *)viewControllerAtIndex:(NSInteger)index;

@end


@interface GKDPageView : UIView

- (instancetype)initWithContainerViewController:(UIViewController *)containerViewController;

@property (nonatomic, weak) id<GKDPageViewDelegate> delegate;
@property (nonatomic, weak) id<GKDPageViewDataSource> dataSource;

@property (nonatomic, strong, readonly) UIViewController *activeController;
@property (nonatomic, assign) BOOL scrollEnable;
@property (nonatomic, assign) NSInteger activeIndex;

- (void)reloadData;

- (void)setActiveIndex:(NSInteger)activeIndex animated:(BOOL)animated;

- (void)setActivIndexAtIndex:(NSInteger)activeIndex duration:(NSTimeInterval)duration animated:(BOOL)animated;

- (void)showViewController:(NSInteger)index;

- (void)enumerateControllerUsingBlock:(void(^)(UIViewController *obj, NSUInteger idx, BOOL *stop))block;

@end
